package demo2;

public class Computer {
    public void powerOn(){
        System.out.println("打开笔记本电脑");
    }
    public void powerOff(){
        System.out.println("关闭笔记本电脑");
    }
    public void useIusbDevice(IUSB iusb){
        iusb.openDevice();
        if(iusb instanceof Mouse){
            Mouse mouse=(Mouse) iusb;
            mouse.clink();
        }else if(iusb instanceof KeyBoard){
            KeyBoard keyBoard=(KeyBoard) iusb;
            keyBoard.inPut();
        }
        iusb.closeDevice();
    }
}
